<?php

/**
 * Albireo Kernel
 *
 * @copyright  Copyright (c) 2010 Albireo Solutions
 * @package    Kernel
 */

namespace WebModule;

use Celebrio\AccessControl\UserManagement;
use Celebrio\AccessControl\AlbireoUser;

/**
 * Sign In Page presenter.
 *
 * @author     Albireo Solutions
 * @package    Kernel
 */
class DefaultPresenter extends BasePresenter {
    const PASS = "whatever";

    public function actionCreate() {
        //TODO: create guest, log him in...
        $user = new AlbireoUser();
        $user->setUsername("elderlyguest2");
        $user->setEmail("whatever@celebrio.cz");
        $user->setLanguage("cs_CZ");
        $user->setTimezone("Europe/Prague");
        
        $um = new UserManagement();
        $um->deleteUser($user);
        if ($um->addUser($user, self::PASS)) {
            $sm = new \KernelModule\SignModel();
            $sm->signIn($this->getUser(), array(
                "username" => "elderlyguest2",
                "password" => self::PASS,
                "redirect" => ":Webtop:Default:seniors",
                "language" => "cs"
                ));
        }
    }
}